﻿using System;
using System.Collections.Generic;

namespace JH
{
    /// <summary>
    ///  图表的数据接口，数据不允许重复
    /// </summary>
    /// <typeparam name="TPoint">数据点类型</typeparam>
    public interface IChart<TPoint> : IDataProcessor<TPoint>
        where TPoint : struct
    {
        /// <summary>
        ///  可以通过此函数刷新图表
        /// </summary>
        public void Refresh();

        /// <summary>
        ///  图表的渲染器列表
        /// </summary>
        public IChartRender[] Renders { get; }

        /// <summary>
        ///  数据点集合
        /// </summary>
        public IReadOnlyList<TPoint> Data { get; }

        /// <summary>
        ///  添加数据点到图表数据中
        /// </summary>
        public void AddPoint(TPoint point);

        /// <summary>
        ///  添加多个数据点到图表数据中
        /// </summary>
        public void AddPoints(IEnumerable<TPoint> points);

        /// <summary>
        ///  添加多个数据点到图表数据中
        /// </summary>
        public void AddPoints( TPoint[] points);
        
        /// <summary>
        ///  从图表数据中移除数据点
        /// </summary>
        public void RemovePoint(TPoint point);

        /// <summary>
        ///  从图表数据中移除多个数据点
        /// </summary>
        public void RemovePoints(IEnumerable<TPoint> points);

        /// <summary>
        ///  根据条件移除数据点
        /// </summary>
        public void RemovePoints(Predicate<TPoint> predicate);

        /// <summary>
        ///  清空图表数据
        /// </summary>
        public void Clear();
    }
}